import { defineStore } from 'pinia';
import { getNowDate } from '@/utils/helper';
interface cartState {
	cartList : any;
}
// 示例
export const useCartStore = defineStore('cart', {
	state:(): cartState => ({
		cartList: [],
	
	}),
	getters: {
		getCartList() {
			return this.cartList;
		},
	},
	actions: {
		setCartList(arr : any) {
			this.cartList = arr;
			console.log('setCartList-store', arr, this.cartList);
		},
		
	},
	persist: {
		storage: {
			getItem: uni.getStorageSync,
			setItem: uni.setStorageSync
		},
		key: 'cartInfo',//本地存储key值
		paths: ['cartList']// 指定持久化的数据，不写默认持久化整个state
	}
});